package com.spzx.product.api.factory;

import com.spzx.common.core.domain.R;
import com.spzx.product.api.RemoteProductService;
import com.spzx.product.api.vo.ProductSkuVo;
import com.spzx.product.api.vo.SkuPriceVo;
import org.springframework.cloud.openfeign.FallbackFactory;

import java.util.List;


public class RemoteProductFallbackFactory implements FallbackFactory<RemoteProductService> {
    @Override
    public RemoteProductService create(Throwable cause) {
        return new RemoteProductService() {

            @Override
            public R<ProductSkuVo> getProductSku(Long skuId,String source) {
                return R.fail("批量获取商品失败,skuId=" + skuId + ":" + cause.getMessage());
            }

            @Override
            public R<List<SkuPriceVo>> getSkuPriceList(List<Long> skuIdList,String source) {
                return R.fail("批量获取商品价格失败" + cause.getMessage());
            }
        };
    }
}
